<template>
  <div class="personal_purse">
    <my-header :showBack="true" :title="$t('lang.SubAccount')" ></my-header>
    <div>
      <div class="memberinlist">
        <ul class="trad_list">
        <van-list v-show="recordList.length>0" v-model="loading" :finished="finished" @load="loadMore" :offset="10" class="">
          <li v-for="item in recordList" :key="item.index">
            <div slot="title" class="jytime">
						<div class="nflex top_contitle">
							<h3>{{$t('lang.userNo')}}：<span>{{item.childNumber}}</span></h3>
							<p class="tipbtn" @click="pushPath('/myChildAssHome/'+item.id)">{{$t('lang.OneClickLogin')}}</p>
						</div>
            <div class="nflex">
							<p>{{$t('lang.CurrentLv')}}<span></span></p>
							<p class=""><span>{{item.levelName}}</span></p>
						</div>
            <div class="nflex">
							<p>{{$t('lang.Time')}}<span></span></p>
							<p class=""><span>{{item.createTime}}</span></p>
						</div>
					</div>
          </li>      
        </van-list>
        </ul> 
      <div class="no_data" v-show="recordList.length==0">{{$t("lang.NoData")}}</div>
    </div>
    </div>
  </div>
</template>

<script>
import header from "@/components/header";
import { Toast } from 'vant';
import ClipboardJS from 'Clipboard'

export default {
  components: {
    "my-header": header
  }, 
  data(){
    return{
      userInfo:{},
      loading:false,
      finished:true,
      orMenberList:[1,2,3,4,5,6],
      loading: false,
      finished: true,
      recordList: [],
      searchData: {
        pageNo: 1, //当前页
        pageSize: 30, //每页30条
      },
    }
  },
  filters: {
    formatDate(time) {
      var date = new Date(time);
      return timeFormat.formatDate(date, "yyyy.MM.dd hh:mm");
    }
  },
  mounted(){
    this.init();
  },
  methods:{
    init() {
      this.searchData.pageNo = 1;
      this.$ajax(this.$api.childList, this.searchData).then(res => {
        this.loading = false;
        if (res.code === 0) {
          if (res.msg && res.msg.list.length > 0) {
						this.recordList = res.msg.list;
            this.finished = this.searchData.pageNo == res.msg.lastPage;
            this.loading = false;
          }
        } else {
          this.recordList = [];
        }
      });
    },
    loadMore: function() {
      this.searchData.pageNo += 1;
      this.$ajax(this.$api.childList, this.searchData).then(res => {
        this.loading = false;
        if (res.code === 0) {
          if (res.msg && res.msg.list.length > 0) {
            this.recordList = this.recordList.concat(res.msg.list);
            this.finished = this.searchData.pageNo == res.msg.lastPage;
            this.loading = false;
          }
        }
      });
    },
  }
}
</script>

<style lang="less" scoped>
.personal_purse{background: #f6f6f6;}
.trad_list{
	margin-top:0px;
		h3{color: #333333;line-height: 26px;}
		li{margin-bottom: 10px;background: #ffffff;box-sizing: border-box;padding: 10px 12px 0 12px;}
		.nflex{display: flex;justify-content:space-between ;
      p{line-height: 25px;color: #999999;}
			span{color: #333333;}
			.npadd{padding: 15px 0;}
			.tiphui{color: #999999;}
			.tipred{color: #FF5458;height: 25px;}
      .tipgren{color: #00BA4F;}
      .tipbtn{color: #0a6cf3;height: 25px;border: 1px solid #0a6cf3;padding: 0 5px;border-radius: 8px;}
    }
    .top_contitle{border-bottom: 1px solid #eeeeee;padding-bottom:6px; }
		.buybtn{color: #FF4954;border: 1px solid #FF4954;border-radius: 20px;padding: 0 6px ;}		
}
.jihuobord{border: 1px solid #FF4954;border-radius: 10px;padding: 0px 6px ;font-size: 12px;height: 20px;}
.jytime{
	h3{color: #333333;font-size: 14px;font-weight: 600;}
  p{color: #CCCCCC;}
  .bottom_time{
    border-top:1px solid #eeeeee;padding: 12px 0;
    p{color: #333333;}
    }
	}
</style>
